<template>
  <div class="basic-layout">
    <div class="nav-side">
      <LabelSidebar />
    </div>

    <div class="content-right">
      <div class="nav-top">
        <div class="bread">
          <BreadCurmb />
        </div>

        <div class="user">
          <UserDropdown />
        </div>
      </div>
      <div class="wrapper">
        <div class="main-page">
          <router-view></router-view>
        </div>
      </div>
    </div>

  </div>
</template>
<script>
import Menu from './Menu.vue';
import BreadCurmb from './BreadCurmb.vue';
import Loginout from './Loginout.vue';
export default {
  name: 'Home',
  components: { LabelSidebar: Menu, BreadCurmb, UserDropdown: Loginout }
}
</script>

<style lang="scss">
.basic-layout {
  position: relative;
  padding: 0;

  .nav-side {
    position: fixed;
    width: 200px;
    height: 100vh;
    background-color: #001529;
    color: #fff;
    overflow-y: auto;
    transition: width .5s;
  }

  .content-right {
    margin-left: 200px;
    overflow-y: auto;
    scrollbar-gutter: stable; /* 保持滚动条空间，即使没出现滚动条 */
    // height: 100vh;
    // display: flex;

    .nav-top {
      position: sticky; // ✅ 吸附顶部
      top: 0; // ✅ 吸附在顶部 0px
      z-index: 10; // ✅ 确保在表格等内容之上
      height: 50px;
      line-height: 50px;
      display: flex;
      justify-content: space-between;
      border-bottom: 1px solid #ddd;
      background-color: #fff;
      padding: 0 20px;
    }

    .wrapper {
      background: #eef0f3;
      padding: 20px;
      height: calc(100vh - 91px);

      // overflow-y: auto;
      .main-page {
        // background: #fff;
        height: 100%;
      }
    }
  }
}
</style>
